package com.leo.listener;

import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.JobKey;
import org.quartz.JobListener;

/**
 * @ClassName MyJobListener
 * @Description job监听器
 * @Author wangss
 * @date 2021.07.15 10:34
 * @Version 1.0
 */
public class MyJobListener implements JobListener {
    @Override
    public String getName() {
        return "MyJobListener";
    }

    @Override
    public void jobToBeExecuted(JobExecutionContext jobExecutionContext) {
        JobKey key = jobExecutionContext.getJobDetail().getKey();
        System.out.println("job = [" + key + "] 开始执行了");
    }

    @Override
    public void jobExecutionVetoed(JobExecutionContext jobExecutionContext) {
        JobKey key = jobExecutionContext.getJobDetail().getKey();
        System.out.println("job = [" + key + "] 这个不知道是干嘛的");
    }

    @Override
    public void jobWasExecuted(JobExecutionContext jobExecutionContext, JobExecutionException e) {
        JobKey key = jobExecutionContext.getJobDetail().getKey();
        System.out.println("job = [" + key + "] 执行结束了");
    }
}
